#include <stdio.h>
#include <math.h>
/* Diviser le quart de cercle en steps parties égales,
   et on décale d'une moitié de partie */
int main() {
 
  unsigned int steps = 16;
//  unsigned int vmax = 1024; // 0x400 for PWM freq = 19kHz
  unsigned int vmax = 512; // 0x400 for PWM freq = 19kHz
//  unsigned int vmax = 256; // 0x0ff for PWM Freq = 78kHz
//  unsigned int vmax = 128; // 0x07f for PWM Freq = 156kHz
//  unsigned int vmax = 32;
  unsigned int value = 0;
  unsigned int i;
  double x = 0.0, xstart = 0.0, xend = M_PI / 2;

  //x = (xend - xstart) / (2*steps);
  x=xstart;
  value = floor(sin(x) * vmax);
  printf("0x%04x, ",  value);
  for (i = 1; i < steps; i++) {
    x = x + ((xend - xstart) / (steps - 1));
    value = floor(sin(x) * vmax);
    //    value = ceil(sin(x) * vmax);
    printf("0x%04x, ",  value);
  }
  return(0); 

}
